extends CharacterBody2D

const SPEED: float = 300.0
# 自定义撞机信号
signal rock_entered


func _physics_process(delta):
	self.velocity.x = SPEED * -1
	move_and_slide()
	# 判断出边界,销毁障碍物
	if self.position.x <= -56:
		self.queue_free()

# 碰撞体进入该区域触发
func _on_area_2d_body_entered(body):
	# 发出碰撞信号
	rock_entered.emit()
